namespace CSharpPro1._1009;

public class Demo
{
    public void Test1()
    {
        for (int num = 100; num < 1000; num++)
        {
            int hundreds = num / 100; 
            int tens = (num / 10) % 10; 
            int units = num % 10; 

            
            int sumOfCubes = (int)(Math.Pow(hundreds, 3) + Math.Pow(tens, 3) + Math.Pow(units, 3));

            
            if (sumOfCubes == num)
            {
                Console.WriteLine(num);
            }
        }
    }


    public void Test2()
    {
        Console.WriteLine("100 以内的质数有：");
       
        for (int num = 2; num <= 100; num++)
        {
            bool isPrime = true;
            
            for (int i = 2; i < num; i++)
            {
                if (num % i == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                Console.Write(num + " ");
            }
        }
    }
}